package com.software.yh.service;

import com.software.proto.HelloProto;
import com.software.proto.HelloServiceGrpc;
import io.grpc.stub.StreamObserver;
import lombok.extern.slf4j.Slf4j;
import net.devh.boot.grpc.server.service.GrpcService;

/**
 * @author: lsy
 * @date: 2025/11/5
 * @version: 1.0
 */
@Slf4j
@GrpcService
public class HelloGrpcService extends HelloServiceGrpc.HelloServiceImplBase {
    @Override
    public void hello(HelloProto.HelloRequest request, StreamObserver<HelloProto.HelloResponse> responseObserver) {
        log.info("join HelloGrpcService ~ ");
        final String name = request.getName();
        responseObserver.onNext(HelloProto.HelloResponse.newBuilder().setMessage("hello, " + name).build());
        responseObserver.onCompleted();
    }
}
